package com.sword.invoice.channel.lq.adapt;

import com.sword.common.bean.Result;
import com.sword.invoice.bean.enums.InvoiceChannelEnum;
import com.sword.invoice.channel.lq.infrastructure.impl.LqServiceImp;
import com.sword.invoice.repository.AbsBlueInvoiceStrategy;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Singleton;

/**
 * @description: 乐企开蓝票渠道
 * @author：Lv.RJ
 * @version: 1.0.0
 * @create: 2025/02/17
 **/
@Component
@Singleton(false)
public class LqBlueInvoiceStrategyAdapter extends AbsBlueInvoiceStrategy {
    //方式1
    /*    @Autowired
        ISLqService lqService;*/

    //方式2
    /*@Autowired
    ISLqServiceImpl lqService;*/

    //方式3
//    private static ISLqService lqService = new ISLqServiceImpl();

    /**
     * 重新方法
     */
    @Override
    public void doBeforeInvoiceHandler() {

    }

    /**
     * 编写执行
     */
    @Override
    public Result doInvoiceHandler() {

        //        Result pay = AliPayFacade.pay(order, (AlipayParam) payParam, (AliPayConfig) payConfig);
//        System.out.println("线程Id："+Thread.currentThread().getId()
//                +"   线程名称："+Thread.currentThread().getName()
//                +"   type："+this.getOrder().getAppId()
//        );
        System.out.println("type："+this.getOrder().getBillInfoNo());
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return Result.succeed(this.getOrder().getBillInfoNo());
    }

    @Override
    public String getChannelCode() {
        return InvoiceChannelEnum.LQ_INVOICE.getCode();
    }
}
